//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace EntLibContrib.Resource.Configuration
{
	/// <summary>
	/// Overall configuration settings for Resource Management
	/// </summary>    
	public class ResourceManagerSettings : SerializableConfigurationSection
	{
		#region Constants
		/// <summary>
		/// Configuration key for resource manager settings.
		/// </summary>
		public const string SectionName = "resourceConfiguration";
		/// <summary>
		/// manifest extension for all embedded resources.
		/// </summary>
		public const string AssemblyExtension = ".resources";
		/// <summary>
		/// extension for binary resource files.
		/// </summary>
		public const string BinaryExtension = ".resources";
		/// <summary>
		/// extension for Xml resource files.
		/// </summary>
		public const string XmlExtension = ".resx";
		private const string defaultResourceManagerProperty = "defaultResourceManager";
		private const string resourceManagersProperty = "resourceManagers";
		private const string resourceProvidersProperty = "resourceProviders";
		#endregion

		#region Properties
		/// <summary>
		/// Defines the default manager instance to use when no other manager is specified
		/// </summary>
		[ConfigurationProperty(defaultResourceManagerProperty, IsRequired = true)]
		public string DefaultResourceManager
		{
			get { return (string)base[defaultResourceManagerProperty]; }
			set { base[defaultResourceManagerProperty] = value; }
		}

		/// <summary>
		/// Gets the collection of defined <see cref="ResourceManager"/> objects.
		/// </summary>
		/// <value>
		/// The collection of defined <see cref="ResourceManager"/> objects.
		/// </value>
		[ConfigurationProperty(resourceManagersProperty, IsRequired = true)]
		public NamedElementCollection<ResourceManagerData> ResourceManagers
		{
			get { return (NamedElementCollection<ResourceManagerData>)base[resourceManagersProperty]; }
		}

		/// <summary>
		/// Gets the collection of defined <see cref="IResourceProvider"/> objects.
		/// </summary>
		/// <value>
		/// The collection of defined <see cref="IResourceProvider"/> objects.
		/// </value>
		[ConfigurationProperty(resourceProvidersProperty, IsRequired = true)]
		public NameTypeConfigurationElementCollection<ResourceProviderData, CustomResourceProviderData> ResourceProviders
		{
			get { return (NameTypeConfigurationElementCollection<ResourceProviderData, CustomResourceProviderData>)base[resourceProvidersProperty]; }
		}
		#endregion
	}
}